package com.googlecode.linkmein.domain;

import com.googlecode.linkmein.repository.ObjectStorage;

import java.util.ArrayList;

public class MapInfoes extends ArrayList<MapInfo> {
    public MapInfoes(MapInfo... mapInfoes) {
        for (MapInfo mapInfo : mapInfoes) {
            this.add(mapInfo);
        }
    }

    public static MapInfoes load(ObjectStorage storage) {
        return storage.findAllMapInfoes();
    }


    public void LoadMapInfo(Employee employee) {
        for (MapInfo mapInfo : this) {
            if (mapInfo.getShrinkedEnglishName().equals(employee.getShrinkedEnglishName())) {
                employee.setMapInfo(mapInfo);
                return;
            }
        }
        employee.setMapInfo(MapInfo.NULL);
    }
}
